package com.example.usercount.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwagerConfig {
    String title = "扣款";
    String description="草草草";
    String version="1.1.1";
//    String termsOfServiceUrl
//    Contact contact,
//    String license,
//    String licenseUrl,
//    Collection<VendorExtension> vendorExtensions)
    @Bean
    public Docket docket(){
        return  new Docket(DocumentationType.SWAGGER_2)
                .enable(true)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.usercount"))
                .paths(PathSelectors.any())
                .build();
    }
    public ApiInfo apiInfo(){
        return  new ApiInfoBuilder().title(title)
                .description(description) // 设置文档的描述
                .version(version) // 设置文档的版本信息-> 1.0.0 Version information
//                .termsOfServiceUrl("www.") // 设置文档的License信息->1.3 License information
                .contact(new Contact("zouzhi","localhost:9000/doc.html","1245268075@qq.com"))
                .build();
    }
}
